{
 "cells": [
  {
   "attachments": {},
   "cell_type": "markdown",
   "id": "a3e6b1da",
   "metadata": {
    "editable": true,
    "id": "a3e6b1da",
    "slideshow": {
     "slide_type": ""
    },
    "tags": []
   },
   "source": [
    "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/pinecone-io/examples/blob/master/docs/quick-tour/interacting-with-the-index.ipynb) [![Open nbviewer](https://raw.githubusercontent.com/pinecone-io/examples/master/assets/nbviewer-shield.svg)](https://nbviewer.org/github/pinecone-io/examples/blob/master/docs/quick-tour/interacting-with-the-index.ipynb)"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "id": "forbidden-sunglasses",
   "metadata": {
    "id": "forbidden-sunglasses",
    "papermill": {
     "duration": 0.053663,
     "end_time": "2021-04-19T21:50:14.234513",
     "exception": false,
     "start_time": "2021-04-19T21:50:14.180850",
     "status": "completed"
    },
    "tags": []
   },
   "source": [
    "# Interacting with a Pinecone index\n",
    "\n",
    "Pinecone creates an index for your input vectors,\n",
    "and it lets you query their nearest neighbors.\n",
    "A Pinecone index supports the following operations:\n",
    "\n",
    "* `upsert`: insert data formatted as `(id, vector)` tuples into the index, or replace existing `(id, vector)` tuples with new vector values. Optionally, you can attach metadata for each vector so you can use them in the query by specifying conditions. The upserted vector will look like `(id, vector, metadata)`.\n",
    "* `delete`: delete vectors by id.\n",
    "* `query`: query the index and retrieve the top-k nearest neighbors based on dot-product, cosine-similarity, Euclidean distance, and more.\n",
    "* `fetch`: fetch vectors stored in the index by id.\n",
    "* `describe_index_stats`: get statistics about the index."
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "id": "quiet-signal",
   "metadata": {
    "id": "quiet-signal",
    "papermill": {
     "duration": 0.035514,
     "end_time": "2021-04-19T21:50:14.305493",
     "exception": false,
     "start_time": "2021-04-19T21:50:14.269979",
     "status": "completed"
    },
    "tags": []
   },
   "source": [
    "## Prerequisites"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "id": "beautiful-paper",
   "metadata": {
    "id": "beautiful-paper",
    "papermill": {
     "duration": 0.032332,
     "end_time": "2021-04-19T21:50:14.372018",
     "exception": false,
     "start_time": "2021-04-19T21:50:14.339686",
     "status": "completed"
    },
    "tags": []
   },
   "source": [
    "Install dependencies."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "complex-diversity",
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "editable": true,
    "id": "complex-diversity",
    "outputId": "be409428-838c-49ad-f6cc-5fd1988fb142",
    "papermill": {
     "duration": 16.408105,
     "end_time": "2021-04-19T21:50:30.816847",
     "exception": false,
     "start_time": "2021-04-19T21:50:14.408742",
     "status": "completed"
    },
    "slideshow": {
     "slide_type": ""
    },
    "tags": []
   },
   "outputs": [],
   "source": [
    "!pip install -qU pandas==2.2.3 pinecone==6.0.2"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4b7eca35",
   "metadata": {
    "editable": true,
    "slideshow": {
     "slide_type": ""
    },
    "tags": []
   },
   "source": [
    "## Creating an Index\n",
    "\n",
    "We begin by instantiating the Pinecone client. To do this we need a [free API key](https://app.pinecone.io)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "296b4b28",
   "metadata": {
    "editable": true,
    "slideshow": {
     "slide_type": ""
    },
    "tags": []
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/opt/conda/lib/python3.12/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
      "  from .autonotebook import tqdm as notebook_tqdm\n"
     ]
    }
   ],
   "source": [
    "import os\n",
    "from pinecone import Pinecone\n",
    "\n",
    "# Get API key at app.pinecone.io\n",
    "api_key = os.environ.get(\"PINECONE_API_KEY\") or \"PINECONE_API_KEY\"\n",
    "\n",
    "# Instantiate the client\n",
    "pc = Pinecone(api_key=api_key)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e5ded34b-58b6-46b1-9c04-b62e380b80a2",
   "metadata": {
    "editable": true,
    "slideshow": {
     "slide_type": ""
    },
    "tags": []
   },
   "source": [
    "### Creating a Pinecone Index\n",
    "\n",
    "When creating the index we need to define several configuration properties. \n",
    "\n",
    "- `name` can be anything we like. The name is used as an identifier for the index when performing other operations such as `describe_index`, `delete_index`, and so on. \n",
    "- `metric` specifies the similarity metric that will be used later when you make queries to the index.\n",
    "- `dimension` should correspond to the dimension of the dense vectors produced by your embedding model. In this quick start, we are using made-up data so a small value is simplest.\n",
    "- `spec` holds a specification which tells Pinecone how you would like to deploy our index. You can find a list of all [available providers and regions here](https://docs.pinecone.io/troubleshooting/available-cloud-regions).\n",
    "\n",
    "There are more configurations available, but this minimal set will get us started."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "MjzMwddcyHM2",
   "metadata": {
    "editable": true,
    "id": "MjzMwddcyHM2",
    "slideshow": {
     "slide_type": ""
    },
    "tags": [
     "parameters"
    ]
   },
   "outputs": [],
   "source": [
    "index_name = \"interacting-with-the-index\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "07826c0c",
   "metadata": {
    "editable": true,
    "slideshow": {
     "slide_type": ""
    },
    "tags": []
   },
   "outputs": [],
   "source": [
    "# Delete the demo index if it already exists\n",
    "if pc.has_index(name=index_name):\n",
    "    pc.delete_index(index_name)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "progressive-blues",
   "metadata": {
    "editable": true,
    "id": "progressive-blues",
    "papermill": {
     "duration": 29.494762,
     "end_time": "2021-04-19T21:51:01.610131",
     "exception": false,
     "start_time": "2021-04-19T21:50:32.115369",
     "status": "completed"
    },
    "slideshow": {
     "slide_type": ""
    },
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{\n",
       "    \"name\": \"interacting-with-the-index\",\n",
       "    \"metric\": \"euclidean\",\n",
       "    \"host\": \"interacting-with-the-index-dojoi3u.svc.aped-4627-b74a.pinecone.io\",\n",
       "    \"spec\": {\n",
       "        \"serverless\": {\n",
       "            \"cloud\": \"aws\",\n",
       "            \"region\": \"us-east-1\"\n",
       "        }\n",
       "    },\n",
       "    \"status\": {\n",
       "        \"ready\": true,\n",
       "        \"state\": \"Ready\"\n",
       "    },\n",
       "    \"vector_type\": \"dense\",\n",
       "    \"dimension\": 2,\n",
       "    \"deletion_protection\": \"disabled\",\n",
       "    \"tags\": null\n",
       "}"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pinecone import ServerlessSpec, Metric, CloudProvider, AwsRegion\n",
    "\n",
    "pc.create_index(\n",
    "    name=index_name,\n",
    "    dimension=2,\n",
    "    metric=Metric.EUCLIDEAN,\n",
    "    spec=ServerlessSpec(cloud=CloudProvider.AWS, region=AwsRegion.US_EAST_1),\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0143b2e9-ef6c-4308-8c6d-bc04d0372888",
   "metadata": {},
   "source": [
    "The index configuration is returned by the create command, but we can look it up again at any time by calling the `describe_index` method."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "b10c2aba-aead-4230-b1e9-3b4a61aeb659",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The index host is interacting-with-the-index-dojoi3u.svc.aped-4627-b74a.pinecone.io\n"
     ]
    }
   ],
   "source": [
    "index_config = pc.describe_index(name=index_name)\n",
    "\n",
    "print(f\"The index host is {index_config.host}\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e524b3fc-a289-4608-97e6-58283c7ca31f",
   "metadata": {},
   "source": [
    "# Using the index\n",
    "\n",
    "Data operations such as `upsert` and `query` are sent directly to the index host instead of `api.pinecone.io`, so we use a different client object object for these operations. By using the `pc.Index()` helper method to construct this index client object, it will automatically inherit your API Key and any other configurations from the parent `Pinecone` instance."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "d686f6a8-5536-4890-a0ca-653a3b62e666",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Instantiate an index client\n",
    "index = pc.Index(host=index_config.host)"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "id": "billion-imperial",
   "metadata": {
    "id": "billion-imperial",
    "papermill": {
     "duration": 0.043379,
     "end_time": "2021-04-19T21:51:01.699928",
     "exception": false,
     "start_time": "2021-04-19T21:51:01.656549",
     "status": "completed"
    },
    "tags": []
   },
   "source": [
    "### Insert vectors\n",
    "\n",
    "In a real use case, the vectors we insert would represent embeddings of our data. But for this simple demo, we will make up some small values just to illustrate the shape of the interface."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "analyzed-charity",
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 206
    },
    "id": "analyzed-charity",
    "outputId": "e6797ecc-f731-40e0-c4bf-a1bc409289dd",
    "papermill": {
     "duration": 0.249711,
     "end_time": "2021-04-19T21:51:01.989157",
     "exception": false,
     "start_time": "2021-04-19T21:51:01.739446",
     "status": "completed"
    },
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>vector</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>A</td>\n",
       "      <td>[1.0, 1.0]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>B</td>\n",
       "      <td>[2.0, 2.0]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>C</td>\n",
       "      <td>[3.0, 3.0]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>D</td>\n",
       "      <td>[4.0, 4.0]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>E</td>\n",
       "      <td>[5.0, 5.0]</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  id      vector\n",
       "0  A  [1.0, 1.0]\n",
       "1  B  [2.0, 2.0]\n",
       "2  C  [3.0, 3.0]\n",
       "3  D  [4.0, 4.0]\n",
       "4  E  [5.0, 5.0]"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Create some fake samsple data\n",
    "import pandas as pd\n",
    "\n",
    "df = pd.DataFrame()\n",
    "df[\"id\"] = [\"A\", \"B\", \"C\", \"D\", \"E\"]\n",
    "df[\"vector\"] = [[1.0, 1.0], [2.0, 2.0], [3.0, 3.0], [4.0, 4.0], [5.0, 5.0]]\n",
    "df"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "id": "e3c126d0",
   "metadata": {
    "id": "e3c126d0",
    "papermill": {
     "duration": 0.045865,
     "end_time": "2021-04-19T21:51:02.074280",
     "exception": false,
     "start_time": "2021-04-19T21:51:02.028415",
     "status": "completed"
    },
    "tags": []
   },
   "source": [
    "We perform upsert operations in our index. The upsert operation will insert a new vector in the index or update the vector if the id was already present."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "checked-christopher",
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "checked-christopher",
    "outputId": "2cc949ae-20d5-49e9-e1f5-edc7f6196ecb",
    "papermill": {
     "duration": 0.489967,
     "end_time": "2021-04-19T21:51:02.616195",
     "exception": false,
     "start_time": "2021-04-19T21:51:02.126228",
     "status": "completed"
    },
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'upserted_count': 5}"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Upsert the vectors\n",
    "index.upsert(vectors=zip(df.id, df.vector))"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "id": "psychological-estate",
   "metadata": {
    "id": "psychological-estate",
    "papermill": {
     "duration": 0.041408,
     "end_time": "2021-04-19T21:51:02.709492",
     "exception": false,
     "start_time": "2021-04-19T21:51:02.668084",
     "status": "completed"
    },
    "tags": []
   },
   "source": [
    "### Fetch vectors"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "varied-scene",
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "varied-scene",
    "outputId": "8ab7b5af-dcc9-4da2-df38-83fc147fe3ce",
    "papermill": {
     "duration": 0.160346,
     "end_time": "2021-04-19T21:51:02.911383",
     "exception": false,
     "start_time": "2021-04-19T21:51:02.751037",
     "status": "completed"
    },
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "FetchResponse(namespace='', vectors={'A': Vector(id='A', values=[1.0, 1.0], metadata=None, sparse_values=None), 'B': Vector(id='B', values=[2.0, 2.0], metadata=None, sparse_values=None)}, usage={'read_units': 1})"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Fetch vectors by ID\n",
    "fetch_results = index.fetch(ids=[\"A\", \"B\"])\n",
    "fetch_results"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "id": "frank-participation",
   "metadata": {
    "id": "frank-participation",
    "papermill": {
     "duration": 0.040162,
     "end_time": "2021-04-19T21:51:02.997106",
     "exception": false,
     "start_time": "2021-04-19T21:51:02.956944",
     "status": "completed"
    },
    "tags": []
   },
   "source": [
    "### Query top-k vectors"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "dried-demographic",
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "dried-demographic",
    "outputId": "9a2c2cac-c4b7-4883-c20c-92bd33121096",
    "papermill": {
     "duration": 0.164285,
     "end_time": "2021-04-19T21:51:03.202342",
     "exception": false,
     "start_time": "2021-04-19T21:51:03.038057",
     "status": "completed"
    },
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'matches': [], 'namespace': '', 'usage': {'read_units': 1}}"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Query top-k nearest neighbors\n",
    "query_results = index.query(vector=[1.1, 1.1], top_k=2)\n",
    "query_results"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "id": "binary-drama",
   "metadata": {
    "id": "binary-drama",
    "papermill": {
     "duration": 0.041674,
     "end_time": "2021-04-19T21:51:03.292154",
     "exception": false,
     "start_time": "2021-04-19T21:51:03.250480",
     "status": "completed"
    },
    "tags": []
   },
   "source": [
    "### Update vectors by ID"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "generic-witness",
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "generic-witness",
    "outputId": "c9e0aa85-be77-4a71-833e-87b875962a25",
    "papermill": {
     "duration": 0.150867,
     "end_time": "2021-04-19T21:51:03.484308",
     "exception": false,
     "start_time": "2021-04-19T21:51:03.333441",
     "status": "completed"
    },
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "FetchResponse(namespace='', vectors={'A': Vector(id='A', values=[1.0, 1.0], metadata=None, sparse_values=None)}, usage={'read_units': 1})"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Fetch current vectors by ID\n",
    "fetch_result = index.fetch(ids=[\"A\"])\n",
    "fetch_result"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "comic-rwanda",
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "comic-rwanda",
    "outputId": "0c2a09c9-4ce8-4a21-81da-448d1aae20fc",
    "papermill": {
     "duration": 0.148497,
     "end_time": "2021-04-19T21:51:03.683025",
     "exception": false,
     "start_time": "2021-04-19T21:51:03.534528",
     "status": "completed"
    },
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'upserted_count': 1}"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Update vectors by ID\n",
    "index.upsert(vectors=[(\"A\", [0.1, 0.1])])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "gentle-messenger",
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "gentle-messenger",
    "outputId": "0b4c6184-45bb-41ff-fadd-eef7074023f0",
    "papermill": {
     "duration": 0.161304,
     "end_time": "2021-04-19T21:51:03.892409",
     "exception": false,
     "start_time": "2021-04-19T21:51:03.731105",
     "status": "completed"
    },
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "FetchResponse(namespace='', vectors={'A': Vector(id='A', values=[0.1, 0.1], metadata=None, sparse_values=None)}, usage={'read_units': 1})"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Fetch vector by the same ID again\n",
    "fetch_result = index.fetch(ids=[\"A\"])\n",
    "fetch_result"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "id": "manual-format",
   "metadata": {
    "id": "manual-format",
    "papermill": {
     "duration": 0.04065,
     "end_time": "2021-04-19T21:51:03.983746",
     "exception": false,
     "start_time": "2021-04-19T21:51:03.943096",
     "status": "completed"
    },
    "tags": []
   },
   "source": [
    "### Delete vectors by ID"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "hispanic-talent",
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "hispanic-talent",
    "outputId": "370409af-beae-4d47-91ab-beaadb10041b",
    "papermill": {
     "duration": 0.14878,
     "end_time": "2021-04-19T21:51:04.172749",
     "exception": false,
     "start_time": "2021-04-19T21:51:04.023969",
     "status": "completed"
    },
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{}"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Delete vectors by ID\n",
    "index.delete(ids=[\"A\"])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "romantic-dubai",
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "romantic-dubai",
    "outputId": "3fa24e74-24fa-4009-c406-791e85451c9d",
    "papermill": {
     "duration": 0.161047,
     "end_time": "2021-04-19T21:51:04.380132",
     "exception": false,
     "start_time": "2021-04-19T21:51:04.219085",
     "status": "completed"
    },
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "FetchResponse(namespace='', vectors={'A': Vector(id='A', values=[0.1, 0.1], metadata=None, sparse_values=None), 'B': Vector(id='B', values=[2.0, 2.0], metadata=None, sparse_values=None)}, usage={'read_units': 1})"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Deleted vectors are empty\n",
    "fetch_results = index.fetch(ids=[\"A\", \"B\"])\n",
    "fetch_results"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "id": "balanced-intellectual",
   "metadata": {
    "id": "balanced-intellectual",
    "papermill": {
     "duration": 0.044809,
     "end_time": "2021-04-19T21:51:04.471991",
     "exception": false,
     "start_time": "2021-04-19T21:51:04.427182",
     "status": "completed"
    },
    "tags": []
   },
   "source": [
    "### Get index statistics"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "nonprofit-popularity",
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "nonprofit-popularity",
    "outputId": "2887c3e9-1820-4e40-9869-80500295bdf7",
    "papermill": {
     "duration": 0.154298,
     "end_time": "2021-04-19T21:51:04.672703",
     "exception": false,
     "start_time": "2021-04-19T21:51:04.518405",
     "status": "completed"
    },
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'dimension': 2,\n",
       " 'index_fullness': 0.0,\n",
       " 'metric': 'euclidean',\n",
       " 'namespaces': {'': {'vector_count': 4}},\n",
       " 'total_vector_count': 4,\n",
       " 'vector_type': 'dense'}"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Index statistics\n",
    "index.describe_index_stats()"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "id": "directed-keyboard",
   "metadata": {
    "id": "directed-keyboard",
    "papermill": {
     "duration": 0.043493,
     "end_time": "2021-04-19T21:51:04.764495",
     "exception": false,
     "start_time": "2021-04-19T21:51:04.721002",
     "status": "completed"
    },
    "tags": []
   },
   "source": [
    "### Delete the index"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "supported-casino",
   "metadata": {
    "id": "supported-casino",
    "papermill": {
     "duration": 12.691337,
     "end_time": "2021-04-19T21:51:17.501135",
     "exception": false,
     "start_time": "2021-04-19T21:51:04.809798",
     "status": "completed"
    },
    "tags": []
   },
   "outputs": [],
   "source": [
    "# Delete the index\n",
    "pc.delete_index(name=index_name)"
   ]
  }
 ],
 "metadata": {
  "colab": {
   "provenance": []
  },
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.9"
  },
  "papermill": {
   "default_parameters": {},
   "duration": 64.825822,
   "end_time": "2021-04-19T21:51:18.073345",
   "environment_variables": {},
   "exception": null,
   "input_path": "/notebooks/quick_tour/interacting_with_the_index.ipynb",
   "output_path": "/notebooks/tmp/quick_tour/interacting_with_the_index.ipynb",
   "parameters": {},
   "start_time": "2021-04-19T21:50:13.247523",
   "version": "2.3.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
